import { createApp } from 'vue';
import App from './App.vue';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import zhCn from 'element-plus/es/locale/lang/zh-cn.mjs';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import router from './router/router';
// import router from './router/adminRouter';
import { createPinia } from 'pinia';
import{createPersistedState} from 'pinia-persistedstate-plugin' //npm install pinia-persistedstate-plugin

// 创建Vue应用实例
const app = createApp(App);

// 创建Pinia实例并配置持久化状态
const pinia = createPinia();
pinia.use(createPersistedState()); // 正确的方式是直接在Pinia实例上调用use方法

// 使用Element Plus、路由和Pinia
app.use(ElementPlus, { locale: zhCn });
app.use(router);
// app.use(adminRouter);
app.use(pinia);

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }

// 挂载应用
app.mount('#app');